import Page1 from '@/components/page1/page1';
import Page2 from '@/components/page2/page2';
import Querypage from '@/components/page2/querypage';
import Vue from 'vue';
import { default as Router, default as VueRouter } from 'vue-router';
Vue.use(VueRouter);

//==========  这里引入组件 ==========

//对外暴露VueRouter类的实例
export default new VueRouter({
	routes: [
		{
			path: '/',  //根路由页面路由的定义
			component: Page1,
		},
		{
			path: '/page1', //page1页面路由的定义
			component: Page1,
		},
		{
			path: '/page2', //page2页面路由的定义
			component: Page2,
			children: [
				{
					name: "detail", //孩子路由的定义
					path: 'view/:index',
					component: Querypage,
				},
			]
		},
	]
})
const routerPush = Router.prototype.push //路由守卫监视
Router.prototype.push = function push(location) {
	return routerPush.call(this, location).catch(error => error)
}
